﻿/*
 * FancyScrollView (https://github.com/setchi/FancyScrollView)
 * Copyright (c) 2020 setchi
 * Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE)
 */

using System.Collections.Generic;
using System.Linq;

namespace UnityEngine.UI.Extensions.Examples.FancyScrollViewExample03
{
    class Example03 : MonoBehaviour
    {
        [SerializeField] ScrollView scrollView = default;

        [SerializeField]
        List<ItemData> items;
        void Start()
        {
            //var items = Enumerable.Range(0, 20)
            //    .Select(i => new ItemData($"{i}", $"Name_{i}",{spriteArr[i]}))
            //    .ToArray();

            scrollView.UpdateData(items);
            scrollView.SelectCell(0);
        }

        [EditorButton]
        public void AddTestData()
        {
            for (int i = 0; i < 10; i++)
            {
                items.Add(new ItemData($"ID_{i}", $"Name_{i}", null));
            }
        }
    }
}
